home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Friends / Wave / WavesWorld / Source / Libraries / tcl7.4b3 / doc / DetachPids.3 < prev    next >
Encoding:
Text File  |  1994-12-17  |  2.4 KB  |  67 lines

  1. '\"
  2. '\" Copyright (c) 1989-1993 The Regents of the University of California.
  3. '\" Copyright (c) 1994 Sun Microsystems, Inc.
  4. '\"
  5. '\" See the file "license.terms" for information on usage and redistribution
  6. '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  7. '\" 
  8. '\" @(#) DetachPids.3 1.11 94/12/17 16:17:18
  9. '\" 
  10. .so man.macros
  11. .HS Tcl_DetachPids tclc
  12. .BS
  13. .SH NAME
  14. Tcl_DetachPids, Tcl_ReapDetachedProcs \- manage child processes in background
  15. .SH SYNOPSIS
  16. .nf
  17. \fB#include <tcl.h>\fR
  18. .sp
  19. \fBTcl_DetachPids\fR(\fInumPids, pidPtr\fR)
  20. .sp
  21. .VS
  22. \fBTcl_ReapDetachedProcs\fR()
  23. .VE
  24. .SH ARGUMENTS
  25. .AS int *statusPtr
  26. .AP int numPids in
  27. Number of process ids contained in the array pointed to by \fIpidPtr\fR.
  28. .AP int *pidPtr in
  29. Address of array containing \fInumPids\fR process ids.
  30. .BE
  31.  
  32. .SH DESCRIPTION
  33. .PP
  34. .VS
  35. \fBTcl_DetachPids\fR and \fBTcl_ReapDetachedProcs\fR provide a
  36. mechanism for managing subprocesses that are running in background.
  37. These procedures are needed because the parent of a process must
  38. eventually invoke the \fBwaitpid\fR kernel call (or one of a few other
  39. similar kernel calls) to wait for the child to exit.  Until the
  40. parent waits for the child, the child's state cannot be completely
  41. reclaimed by the system.  If a parent continually creates children
  42. and doesn't wait on them, the system's process table will eventually
  43. overflow, even if all the children have exited.
  44. .PP
  45. \fBTcl_DetachPids\fR may be called to ask Tcl to take responsibility
  46. for one or more processes whose process ids are contained in the
  47. \fIpidPtr\fR array passed as argument.  The caller presumably
  48. has started these processes running in background and doesn't
  49. want to have to deal with them again.
  50. .PP
  51. \fBTcl_ReapDetachedProcs\fR invokes the \fBwaitpid\fR kernel call
  52. on each of the background processes so that its state can be cleaned
  53. up if it has exited.  If the process hasn't exited yet,
  54. \fBTcl_ReapDetachedProcs\fR doesn't wait for it to exit;  it will check again
  55. the next time it is invoked.
  56. Tcl automatically calls \fBTcl_ReapDetachedProcs\fR each time the
  57. \fBexec\fR command is executed, so in most cases it isn't necessary
  58. for any code outside of Tcl to invoke \fBTcl_ReapDetachedProcs\fR.
  59. However, if you call \fBTcl_DetachPids\fR in situations where the
  60. \fBexec\fR command may never get executed, you may wish to call
  61. \fBTcl_ReapDetachedProcs\fR from time to time so that background
  62. processes can be cleaned up.
  63. .VE
  64.  
  65. .SH KEYWORDS
  66. background, child, detach, process, wait
  67.